package com.xxdd.kotlindemo

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Environment
import android.os.Environment.MEDIA_MOUNTED
import android.view.View
import kotlinx.android.synthetic.main.activity_main.*
import java.io.File

class MainActivity : AppCompatActivity(){



    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        btn_load.setOnClickListener(View.OnClickListener {
            if (Environment.getExternalStorageState() == MEDIA_MOUNTED){
                val file = File(Environment.getExternalStorageDirectory(), "plugina.apk")
                PluginManagerImp.loadPath(this@MainActivity.applicationContext, file.absolutePath)
            }


        })

        btn_jump.setOnClickListener(View.OnClickListener {
            val intent = Intent()
            intent.setClass(this@MainActivity, ContainerAcitivity::class.java)
            startActivity(intent)
        })

    }
}